import 'dart:io';
import 'ansi_color.dart';

enum Level {
  def,
  debug,
  info,
  warning,
  error,
  verbose,
}

void logPrint(Object? object, {Level level = Level.def}) {
  Function color;
  switch (level) {
    case Level.debug:
      color = AnsiColor.debug;
      break;
    case Level.info:
      color = AnsiColor.info;
      break;
    case Level.warning:
      color = AnsiColor.warning;
      break;
    case Level.error:
      color = AnsiColor.error;
      break;
    case Level.verbose:
      color = AnsiColor.verbose;
      break;
    case Level.def:
    default:
      color = AnsiColor.def;
      break;
  }
  stdout.writeln(color(object.toString()));
}
